package com.dingwen.treasure.business.controller;

import com.dingwen.treasure.base.controller.BaseViewController;
import com.dingwen.treasure.base.enums.ActivityStatusEnum;
import com.dingwen.treasure.base.pojo.vo.Result;
import com.dingwen.treasure.business.factory.ActivityStatusFactory;
import com.dingwen.treasure.business.service.ActivityStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 　MarketingController: 活动营销 （状态模式实现）</br>
 * <p>主要功能：</p>
 * <ol>
 *     <li>营销活动</li>
 *     <li>多级审核</li>
 *     <li>状态流转</li>
 *     <li>流程控制</li>
 * </ol>
 * <p>
 * 　@author dingwen
 * 　@date 2022/5/14
 */
@Api(tags = "活动营销，状态模式实现")
@RestController
@RequestMapping("marketing")
@Slf4j
@SuppressWarnings("ALL")
public class MarketingController implements BaseViewController {


    /**
     * 更新活动状态
     *
     * @return {@link Result}
     */
    @ApiOperation("更新活动状态")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "status", value = "活动状态"),
                    @ApiImplicitParam(name = "activityId", value = "活动ID")
            }
    )
    @GetMapping()
    public void updateStatus(@RequestParam ActivityStatusEnum status, @RequestParam Long activityId) {
        ActivityStatusService activityStatusService = ActivityStatusFactory.ACTIVITY_STATUS_SERVICE.get(status.name());
        //activityStatusService.editing(activityId, status);
        //activityStatusService.reviewing(activityId, status);
        //activityStatusService.rejecting(activityId, status);
        activityStatusService.passing(activityId, status);
        //activityStatusService.opening(activityId, status);
        //activityStatusService.closing(activityId, status);
    }
}
